package de.joergviola.mobj.shared;

import java.io.Serializable;

public class Filter implements Serializable {

	private static final long serialVersionUID = -3095853748026701556L;
	private String field;
	private String operator;
	private String stringValue;
	private Long longValue;

	public Filter() {
	}

	public Filter(String field, String operator, String stringValue) {
		this.field = field;
		this.operator = operator;
		this.stringValue = stringValue;
	}

	public Filter(String field, String operator, Long longValue) {
		this.field = field;
		this.operator = operator;
		this.longValue = longValue;
	}

	public String getField() {
		return field;
	}

	public String getOperator() {
		return operator;
	}

	public Object getValue() {
		if (stringValue != null) {
			return stringValue;
		} else if (longValue != null) {
			return longValue;
		} else {
			return null;
		}
	}

	@Override
	public String toString() {
		return field + operator + getValue();
	}
}